//维护通知

#include <stdint.h>
#include "temperature_control_sub_module\FanCtrl.h"


#define Firepot_Max_Time 3*60*60 //显示清理火罐通知的倒计时时间,单位: s
#define GreaseTrap_Max_Time 3*60*60 //单位: s
#define Later_Time 1*60*60 //600 //推迟通知的时间，单位: s

uint8_t Maintain_ID; //记录切换通知界面前的界面


struct Maintain_Firepot
{
    uint8_t Flag; //0:正在倒计时, 1:time to
    //进料马达打开后开始倒计时,进料马达停止后停止倒计
    uint32_t Time; //内燃烧室,炉膛, 单位:s
}Firepot = {0, Firepot_Max_Time, 0};

struct Maintain_GreaseTrap
{
    uint8_t Flag; //0: 正在倒计时, 1:time to
    uint32_t Time; //烤网, 单位:s
}GreaseTrap = {0, GreaseTrap_Max_Time, 0};



//Tick 1s
void Maintain_Clock(void)
{
    if(Fan_State.Fan > 0)
    { //排气(橙线)风扇
        if(GreaseTrap.Time > 0) GreaseTrap.Time--;
    }
    
    if(Fan_State.Feed > 0)
    { //进料(红线)打开
        if(Firepot.Time > 0) Firepot.Time--;
    }
}

void Maintain_GreaseTrap_Later(void)
{
    if(GreaseTrap.Flag > 0) GreaseTrap.Time = Later_Time;
}
void Maintain_GreaseTrap_Done(void)
{
    if(GreaseTrap.Flag > 0) GreaseTrap.Time = GreaseTrap_Max_Time;
}

void Maintain_Firepot_Later(void)
{
    if(Firepot.Flag > 0) Firepot.Time = Later_Time;
}
void Maintain_Firepot_Done(void)
{
    if(Firepot.Flag > 0) Firepot.Time = Firepot_Max_Time;
}

void Maintain_Main(void)
{
    if(GreaseTrap.Time == 0) GreaseTrap.Flag = 1; //Time to
    else GreaseTrap.Flag = 0;
    if(Firepot.Time == 0) Firepot.Flag = 1; //Time to
    else Firepot.Flag = 0;
    if (GreaseTrap.Flag > 0)
    {
    }
    else if(Firepot.Flag > 0)
    {
    }
    else
    {
    }
}
